//
//  RefuseViewController.m
//  UcarTest
//
//  Created by 陈曦 on 16/3/23.
//  Copyright © 2016年 chenxi. All rights reserved.
//

#import "RefuseViewController.h"
#import "Define.h"
#import "AFNetworking.h"
#import "NetRequestGroup.h"
#import "Access_token.h"
#import "MBProgressHUD.h"
#import "DIYCarDetailButton.h"
#import "CarOwnerOrdersViewController.h"
#import "CarDetailForgeViewController.h"


@interface RefuseViewController ()

@property (nonatomic, strong) UIScrollView *backgroundScrollView;

@property (nonatomic, strong) DIYCarDetailButton *carDetailBtn;

@end

@implementation RefuseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //导航条设置
    [self navigationItemSet];
    
    //背景视图
    self.backgroundScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - 48)];
    self.backgroundScrollView.backgroundColor = backgroundMainColor;
    [self.view addSubview:self.backgroundScrollView];
    self.backgroundScrollView.contentSize = CGSizeMake(kScreenWidth, kScreenHeight * 1.1);
    [self.view addSubview:self.backgroundScrollView];
    
    
    //确认下单按钮
    UIButton *confirmationOrderBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    confirmationOrderBtn.frame = CGRectMake(20, kScreenHeight - 41, kScreenWidth - 40, 34);
    confirmationOrderBtn.layer.cornerRadius = 3;
    confirmationOrderBtn.layer.masksToBounds = YES;
    confirmationOrderBtn.backgroundColor = mainColor;
    [confirmationOrderBtn setTitle:@"拒绝" forState:UIControlStateNormal];
    
    confirmationOrderBtn.titleLabel.tintColor = [UIColor whiteColor];
    [confirmationOrderBtn addTarget:self action:@selector(confirmationOrderPush) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:confirmationOrderBtn];

    
    
    //网络请求
    [self NetworkRequests];
    
    
    
    //创建一个轻拍手势 回收键盘
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap)];
    
    [self.view addGestureRecognizer:tap];

    
}

#pragma mark 网络请求
- (void) NetworkRequests{
    
    //初始化进度框，置于当前的View当中
    MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:self.view];
    [self.view addSubview:HUD];
    HUD.label.text = @"正在加载";
    [HUD showAnimated:YES];//HUD开始
    
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    //申明返回的结果是json类型
    manager.responseSerializer = [AFJSONResponseSerializer serializer];
    //申明请求的数据是json类型
    manager.requestSerializer = [AFHTTPRequestSerializer serializer];
    //如果报接受类型不一致请替换一致text/html或别的
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    Access_token *useAccess = [Access_token shareInstance];
    
    //传入的参数
    NSDictionary *para = @{
                           @"type" : @"1",
                           @"access_token" : useAccess.access_token,
                           @"id" : self.id,
                           @"order_type" : @"1"
                           };
    //你的接口地址
    NSString *url = [NSString stringWithFormat:@"%@%@", kRealmName,kNetCarOrderDetailView];
    //发送请求
    [manager POST:url parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        [HUD hideAnimated:YES];
        
        
        NSDictionary *dic = responseObject;
        
        NSDictionary *info = dic[@"info"];
        
        self.car_id = info[@"car_id"];
        
        //第一部分
        self.brand_str = info[@"car_brand"];
        
        self.model_str = info[@"car_model"];
        
        self.speed_box = info[@"car_speed_box"];
        
        self.place_str = info[@"car_place"];
        
        [self carDetailsView];
        
        //第二部分
        self.order_sn = info[@"order_sn"];
        
        self.anyDayStr = info[@"use_time"];
        
        //字符串转换成时间戳
        NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:[info[@"open_time"] intValue]];
        NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
        [dateFormat setDateFormat:@"yyyy/MM/dd HH:mm"];
        NSString *open_time = [dateFormat stringFromDate:confromTimesp];
        
        NSDate *confromTimesp1 = [NSDate dateWithTimeIntervalSince1970:[info[@"end_time"] intValue]];
        NSDateFormatter *dateFormat1 = [[NSDateFormatter alloc]init];
        [dateFormat1 setDateFormat:@"yyyy/MM/dd HH:mm"];
        NSString *end_time = [dateFormat1 stringFromDate:confromTimesp1];
        
        self.openAndTimeStr = [NSString stringWithFormat:@"(%@ - %@)", open_time, end_time];
        
        self.addressStr = info[@"car_address"];
        
        self.order_status = info[@"order_status"];
        
        [self orderDetailsView];
        
        //第三部分
        [self RefuseUpLoginingView];
        
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        [HUD hideAnimated:YES];
        
        //初始化提示框；
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"没有网络" preferredStyle:  UIAlertControllerStyleAlert];
        
        [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            //点击按钮的响应事件；
        }]];
        
        //弹出提示框；
        [self presentViewController:alert animated:true completion:nil];
        
        
    }];
    
}



//车辆信息
- (void) carDetailsView{
    
    //第一部分 车辆信息
    UIView *carDetails = [[UIView alloc] initWithFrame:CGRectMake(5, 15, kScreenWidth - 10, 70)];
    carDetails.layer.cornerRadius = 2;
    carDetails.layer.shadowOpacity = 1.0;
    carDetails.layer.shadowOffset = CGSizeMake(0.0, 0.0);
    carDetails.layer.shadowColor = [UIColor colorWithRed:215 / 255.0 green:215 / 255.0 blue:215 / 255.0 alpha:1].CGColor;
    carDetails.layer.shadowRadius = 1;
    carDetails.backgroundColor = [UIColor whiteColor];
    [self.backgroundScrollView addSubview:carDetails];
    
    //车辆信息跳转按钮
    self.carDetailBtn = [DIYCarDetailButton buttonWithType:UIButtonTypeCustom];
    self.carDetailBtn.frame = CGRectMake(0, 0, kScreenWidth - 10, 35);
    self.carDetailBtn.layer.cornerRadius = 2;
    self.carDetailBtn.layer.masksToBounds = YES;
    [self.carDetailBtn addTarget:self action:@selector(carDetailBtnPush) forControlEvents:UIControlEventTouchUpInside];
    [carDetails addSubview:self.carDetailBtn];
    
    //车品牌
    self.carNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 35, 25, 35)];
    self.carNameLabel.textAlignment = NSTextAlignmentCenter;
    self.carNameLabel.font = [UIFont systemFontOfSize:12];
    self.carNameLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    self.carNameLabel.text = self.brand_str;
    [carDetails addSubview:self.carNameLabel];
    
    //牌照
    self.licensePlateLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, 35, 80, 35)];
    self.licensePlateLabel.textAlignment = NSTextAlignmentCenter;
    self.licensePlateLabel.font = [UIFont systemFontOfSize:12];
    self.licensePlateLabel.textColor = mainColor;
    self.licensePlateLabel.text = self.place_str;
    [carDetails addSubview:self.licensePlateLabel];
    
    //型号
    self.modelLabel = [[UILabel alloc] initWithFrame:CGRectMake(145, 45, 40, 15)];
    self.modelLabel.backgroundColor = [UIColor orangeColor];
    self.modelLabel.layer.cornerRadius = 2;
    self.modelLabel.layer.masksToBounds = YES;
    self.modelLabel.textAlignment = NSTextAlignmentCenter;
    self.modelLabel.font = [UIFont systemFontOfSize:12];
    self.modelLabel.textColor = [UIColor whiteColor];
    self.modelLabel.text = self.model_str;
    [carDetails addSubview:self.modelLabel];
    
    //自动或手动
    self.speed_boxLabel = [[UILabel alloc] initWithFrame:CGRectMake(205, 45, 40, 15)];
    self.speed_boxLabel.backgroundColor = [UIColor grayColor];
    self.speed_boxLabel.layer.cornerRadius = 2;
    self.speed_boxLabel.layer.masksToBounds = YES;
    self.speed_boxLabel.textAlignment = NSTextAlignmentCenter;
    self.speed_boxLabel.font = [UIFont systemFontOfSize:12];
    self.speed_boxLabel.textColor = [UIColor whiteColor];
    self.speed_boxLabel.text = self.speed_box;
    [carDetails addSubview:self.speed_boxLabel];
    
    
    //分割线
    UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 35, kScreenWidth - 20, 0.5)];
    lineLabel.backgroundColor = lineColor;
    [carDetails addSubview:lineLabel];
    
    
}

//订单信息
- (void) orderDetailsView{
    
    //第二部分 订单信息
    UIView *orderDetails = [[UIView alloc] initWithFrame:CGRectMake(5, 100, kScreenWidth - 10, 160)];
    orderDetails.layer.cornerRadius = 2;
    orderDetails.layer.shadowOpacity = 1.0;
    orderDetails.layer.shadowOffset = CGSizeMake(0.0, 0.0);
    orderDetails.layer.shadowColor = [UIColor colorWithRed:215 / 255.0 green:215 / 255.0 blue:215 / 255.0 alpha:1].CGColor;
    orderDetails.layer.shadowRadius = 1;
    orderDetails.backgroundColor = [UIColor whiteColor];
    [self.backgroundScrollView addSubview:orderDetails];
    
    UIImageView *orderImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 20, 20)];
    orderImageView.image = [UIImage imageNamed:@"icon-indent-blue"];
    [orderDetails addSubview:orderImageView];
    
    UILabel *orderInformation = [[UILabel alloc] initWithFrame:CGRectMake(40, 10, 50, 20)];
    orderInformation.text = @"订单信息";
    orderInformation.textAlignment = NSTextAlignmentRight;
    orderInformation.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    orderInformation.font = [UIFont systemFontOfSize:12];
    [orderDetails addSubview:orderInformation];
    
    UILabel *orderStatusLabel = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth - 80, 10, 60, 20)];
    
    if ([self.order_status isEqualToString:@"0"] ) {
        orderStatusLabel.text = @"待支付";
    } else if ([self.order_status isEqualToString:@"1"]) {
        orderStatusLabel.text = @"待确认";
    } else if ([self.order_status isEqualToString:@"2"]) {
        orderStatusLabel.text = @"待支付";
    } else if ([self.order_status isEqualToString:@"3"]) {
        orderStatusLabel.text = @"用车";
    } else if ([self.order_status isEqualToString:@"4"]) {
        orderStatusLabel.text = @"已完成";
    } else if ([self.order_status isEqualToString:@"5"]) {
        orderStatusLabel.text = @"取消订单";
    }
    orderStatusLabel.textColor = mainColor;
    orderStatusLabel.textAlignment = NSTextAlignmentRight;
    orderStatusLabel.font = [UIFont systemFontOfSize:12];
    [orderDetails addSubview:orderStatusLabel];
    
    //用车时间标签
    UILabel *useCarTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 60, 70, 14)];
    useCarTimeLabel.text = @"订单号:";
    useCarTimeLabel.textAlignment = NSTextAlignmentRight;
    useCarTimeLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    useCarTimeLabel.font = [UIFont systemFontOfSize:14];
    [orderDetails addSubview:useCarTimeLabel];
    
    UILabel *orderNumberLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 60, kScreenWidth / 5 * 3, 14)];
    orderNumberLabel.text = self.order_sn;
    orderNumberLabel.textAlignment = NSTextAlignmentLeft;
    orderNumberLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    orderNumberLabel.font = [UIFont systemFontOfSize:14];
    [orderDetails addSubview:orderNumberLabel];
    
    
    //用车时间
    UILabel *exchangeAdressLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 94, 70, 14)];
    exchangeAdressLabel.text = @"用车时间:";
    exchangeAdressLabel.textAlignment = NSTextAlignmentRight;
    exchangeAdressLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    exchangeAdressLabel.font = [UIFont systemFontOfSize:14];
    [orderDetails addSubview:exchangeAdressLabel];
    
    UILabel *useCarLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 94, 30, 14)];
    useCarLabel.text = self.anyDayStr;
    useCarLabel.textAlignment = NSTextAlignmentLeft;
    useCarLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    useCarLabel.font = [UIFont systemFontOfSize:14];
    [orderDetails addSubview:useCarLabel];
    
    UILabel *openEndTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(130, 84, kScreenWidth / 2 + 20, 36)];
    openEndTimeLabel.text = self.openAndTimeStr;
    openEndTimeLabel.textAlignment = NSTextAlignmentLeft;
    openEndTimeLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    openEndTimeLabel.font = [UIFont systemFontOfSize:10];
    [orderDetails addSubview:openEndTimeLabel];
    
    //交车地点
    UILabel *cashPledgeLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 128, 70, 14)];
    cashPledgeLabel.text = @"交车地点:";
    cashPledgeLabel.textAlignment = NSTextAlignmentRight;
    cashPledgeLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    cashPledgeLabel.font = [UIFont systemFontOfSize:14];
    [orderDetails addSubview:cashPledgeLabel];
    
    //交车地点显示标签
    self.car_addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 118, kScreenWidth / 5 * 3, 36)];
    self.car_addressLabel.text = self.addressStr;
    self.car_addressLabel.numberOfLines = 0;
    self.car_addressLabel.lineBreakMode = NSLineBreakByWordWrapping;
    self.car_addressLabel.textAlignment = NSTextAlignmentLeft;
    self.car_addressLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    self.car_addressLabel.font = [UIFont systemFontOfSize:14];
    [orderDetails addSubview:self.car_addressLabel];
    
    
    //分割线
    UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 40, kScreenWidth - 20, 0.5)];
    lineLabel.backgroundColor = lineColor;
    [orderDetails addSubview:lineLabel];
    
}

//第三部分
//照片
- (void) RefuseUpLoginingView{
    
    //第一部分 车辆信息
    UIView *RefuseUpLoginView = [[UIView alloc] initWithFrame:CGRectMake(5, 280, kScreenWidth - 10, 250)];
    RefuseUpLoginView.layer.cornerRadius = 2;
    RefuseUpLoginView.layer.shadowOpacity = 1.0;
    RefuseUpLoginView.layer.shadowOffset = CGSizeMake(0.0, 0.0);
    RefuseUpLoginView.layer.shadowColor = [UIColor colorWithRed:215 / 255.0 green:215 / 255.0 blue:215 / 255.0 alpha:1].CGColor;
    RefuseUpLoginView.layer.shadowRadius = 1;
    RefuseUpLoginView.backgroundColor = [UIColor whiteColor];
    [self.backgroundScrollView addSubview:RefuseUpLoginView];
    
    UIImageView *cameraPhotoIV = [[UIImageView alloc] initWithFrame:CGRectMake(10, 13, 20, 20)];
    cameraPhotoIV.image = [UIImage imageNamed:@"icon-compile"];
    [RefuseUpLoginView addSubview:cameraPhotoIV];
    
    UILabel *takePhotosForCar = [[UILabel alloc] initWithFrame:CGRectMake(40, 15, 85, 15)];
    takePhotosForCar.text = @"拒绝理由";
    takePhotosForCar.textAlignment = NSTextAlignmentCenter;
    takePhotosForCar.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    takePhotosForCar.font = [UIFont systemFontOfSize:14];
    [RefuseUpLoginView addSubview:takePhotosForCar];
    
//    self.refudeTextfield = [[UITextField alloc] initWithFrame:CGRectMake(10, 50, kScreenWidth - 30, 190)];
//    self.refudeTextfield.placeholder = @"填写拒绝理由";
//    self.refudeTextfield.textAlignment = NSTextAlignmentLeft;
//    self.refudeTextfield.font = [UIFont systemFontOfSize:14];
//    [RefuseUpLoginView addSubview:self.refudeTextfield];
    
    self.refudeTextfield = [[UITextView alloc] initWithFrame:CGRectMake(10, 50, kScreenWidth - 30, 190)];
    self.refudeTextfield.backgroundColor=[UIColor whiteColor]; //背景色
    self.refudeTextfield.scrollEnabled = NO;    //当文字超过视图的边框时是否允许滑动，默认为“YES”
    self.refudeTextfield.editable = YES;        //是否允许编辑内容，默认为“YES”
    self.refudeTextfield.delegate = self;       //设置代理方法的实现类
    self.refudeTextfield.font=[UIFont fontWithName:@"Arial" size:14.0]; //设置字体名字和字体大小;
    self.refudeTextfield.returnKeyType = UIReturnKeyDefault;//return键的类型
    self.refudeTextfield.textAlignment = NSTextAlignmentLeft; //文本显示的位置默认为居左
    self.refudeTextfield.keyboardType = UIKeyboardTypeDefault;
    self.refudeTextfield.dataDetectorTypes = UIDataDetectorTypeAll; //显示数据类型的连接模式（如电话号码、网址、地址等）
    self.refudeTextfield.textColor = [UIColor blackColor];
    self.refudeTextfield.text = @"填写拒绝理由";//设置显示的文本内容
    [RefuseUpLoginView addSubview:self.refudeTextfield];
    
    
}


//导航条设置
- (void) navigationItemSet {
    self.navigationController.navigationBarHidden = NO;
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.font = [UIFont boldSystemFontOfSize:18];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.text = @"拒绝订单";
    self.navigationItem.titleView = titleLabel;
    self.navigationController.navigationBar.barTintColor = mainColor;
    self.view.backgroundColor = backgroundMainColor;
    
    
    //重定义返回键
    UIButton *back = [UIButton buttonWithType:UIButtonTypeCustom];
    back.frame = CGRectMake(0, 0, 22, 22);
    [back setImage:[UIImage imageNamed:@"iconfont-fanhui-white"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(backTpMainView) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *backBar = [[UIBarButtonItem alloc] initWithCustomView:back];
    self.navigationItem.leftBarButtonItem = backBar;
    
}

//返回上一页
- (void)backTpMainView{
    
    [self.navigationController popViewControllerAnimated:nil];
    
}

#pragma mark 拒绝按钮
- (void) confirmationOrderPush {
    
    if (self.refudeTextfield.text) {
        
        [self RefuseNetworkRequests:self.id];

    } else {
        
        //初始化提示框；
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"请填写拒绝理由" preferredStyle:  UIAlertControllerStyleAlert];
        
        [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            //点击按钮的响应事件；
        }]];
        
        //弹出提示框；
        [self presentViewController:alert animated:true completion:nil];

    }
    
    
}



#pragma mark 网络请求
- (void) RefuseNetworkRequests:(NSString *)orderID{
    
    //初始化进度框，置于当前的View当中
    MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:self.view];
    [self.view addSubview:HUD];
    HUD.label.text = @"正在加载";
    [HUD showAnimated:YES];//HUD开始
    
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    //申明返回的结果是json类型
    manager.responseSerializer = [AFJSONResponseSerializer serializer];
    //申明请求的数据是json类型
    manager.requestSerializer = [AFHTTPRequestSerializer serializer];
    //如果报接受类型不一致请替换一致text/html或别的
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    Access_token *useAccess = [Access_token shareInstance];
    
    //传入的参数
    NSDictionary *para = @{
                           @"type" : @"1",
                           @"access_token" : useAccess.access_token,
                           @"audit_type" : @"1",
                           @"id" : orderID,
                           @"cancel_cause" : self.refudeTextfield.text
                           };
    //你的接口地址
    NSString *url = [NSString stringWithFormat:@"%@%@", kRealmName, kNetOrderAudit];
    //发送请求
    [manager POST:url parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        [HUD hideAnimated:YES];
        
        
        NSDictionary *dic = responseObject;
        
        self.status = dic[@"status"];
        
        self.msg = dic[@"msg"];
        
        
        [self resultAnalysis];
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        [HUD hideAnimated:YES];
        
        //初始化提示框；
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"没有网络" preferredStyle:  UIAlertControllerStyleAlert];
        
        [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            //点击按钮的响应事件；
        }]];
        
        //弹出提示框；
        [self presentViewController:alert animated:true completion:nil];
        
    }];
    
}


#pragma mark 返回值分析
- (void) resultAnalysis {
    
    int status = [self.status intValue];
    
    switch (status) {
        case 99:{
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 98:{
            
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
        case 97:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 96:
        {
            
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 1:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
        case 2:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
            
        case 100:
        {
            
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"确认成功" preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
                
                CarOwnerOrdersViewController *carowner = [[CarOwnerOrdersViewController alloc] init];
                
                [self.navigationController pushViewController:carowner animated:nil];
                
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
            
        default:
            break;
    }
    
    
    
}

//结束编辑,点击空白回收键盘
- (void)tap
{
    
    //回收键盘
    [self.view endEditing:YES];
    
}
//==============================================================================

//车辆详情跳转
- (void) carDetailBtnPush {
    
    CarDetailForgeViewController *carDetailForgeVC = [[CarDetailForgeViewController alloc] init];
    carDetailForgeVC.carIDStr = self.car_id;
    
    [self.navigationController pushViewController:carDetailForgeVC animated:nil];
    
}



@end
